import os
# open a： append   w: write   r:read 操作、 with open



def method():
    # W 写入文件
    file_1 = open('F:/Idea workspace/tensorflow-learning/data/python/file-1.txt', 'w')
    try:
        file_1.write("zhangjuntao\n")
        file_1.write("26\n")
    finally:
        file_1.close()

    # R 读取文件
    with open('F:/Idea workspace/tensorflow-learning/data/python/file-1.txt', 'r') as file_2:
        for line in file_2.readlines():
            print(line)

    # A 追加文件
    with open('F:/Idea workspace/tensorflow-learning/data/python/file-1.txt', 'a') as file_3:
        file_3.write('sssssssssssssssss')

    # R 读取文件
    with open('F:/Idea workspace/tensorflow-learning/data/python/file-1.txt', 'r') as file_2:
        for line in file_2.readlines():
            print(line)


if __name__ == '__main__':

    path = "/Users/juntao.zhang/dev/workspace/myproject/codes/passport"

    for fpathe,dirs,fs in os.walk(path):
        for f in fs:
            print(os.path.join(fpathe,f))
            if os.path.join(fpathe,f).count("DS_Store") > 0:
                print("+++++++++++++++++++")
